package com.itheima.HomeWork_day10;

import java.util.*;

/*
自定义的hash集合时,应该重写equals方法和hashcode方法
 */
public class HashSetTest01 {
    public static void main(String[] args) {

        //创建一个集合
        HashSet<Student> hm = new HashSet<>();

        //存放元素
        hm.add(new Student("张雪",22));
        hm.add(new Student("张天",22));
        hm.add(new Student("付佳",20));
        hm.add(new Student("陈佳名",23));


        //进行打印
        System.out.println(hm);

//        Iterator<Student> it = hm.iterator();
//        while (it.hasNext()) {
//            System.out.println(it.next());
//        }

    }
}
